package com.hualala.service;

import com.hualala.grpc.message.HelloReply;
import com.hualala.grpc.message.HelloRequest;
import com.hualala.grpc.message.HelloServiceGrpc;
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;
import java.time.LocalDateTime;

/**
 * @author cheng
 */
@GrpcService
public class HelloService extends HelloServiceGrpc.HelloServiceImplBase {


    @Override
    public void queryRequest(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
        responseObserver.onNext(HelloReply.newBuilder().setMessage(String.format("%s_%s", request.getName(), LocalDateTime.now().toString())).build());
        responseObserver.onCompleted();
    }


}
